package be

import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.CountDownTimer
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.View
import android.view.WindowManager
import android.view.animation.AnimationUtils
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import cccf.jjjf.bbbf.R
import eerr.llrr.oorr.pte9983.nvsd
import com.manager.core.ad.mbactivity.RouteActivity
import com.manager.core.ad.tip.AppConst
import com.manager.core.master.scope.AdParams
import com.manager.core.master.view.AutoConfigAdViewScope
import com.manager.core.master.view.ScopeFinishListener
import com.manager.core.pl190.host668.handle.HandlerPostAdInterface
import java.lang.ref.WeakReference
import java.util.Random
import kotlin.jvm.internal.Intrinsics
import kotlin.jvm.internal.Ref

//ceshi
class CQ : RouteActivity(), yyee.llee.mmee.RouteTranInterface {
    companion object {
        var lastUUID: String = ""
    }

    private var adFrameLayout: FrameLayout? = null

    var countDownTimer: CountDownTimer? = null

    var findViewCache: Map<Int?, View?> = LinkedHashMap<Int?, View?>()
    val TAG = "CQ"
    var mHandler = Handler(Looper.getMainLooper())

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_route_child)
        window.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
        initView()
        showAd()
    }

    private fun initView() {
        adFrameLayout = findViewById(R.id.adContentView)
        val ACTION_OUTSIDE_PAGE_CREATED: kotlin.String = "com.green.beans.box.action.OUTSIDE_PAGE_CREATED"
        sendBroadcast(android.content.Intent().setAction(ACTION_OUTSIDE_PAGE_CREATED))
        nvsd.homeKeyAddListener(this) { _, _ ->
            try {
                finishAndRemoveTask()
            } catch (e: Exception) {
                e.printStackTrace()
            }
        }

        supportActionBar?.setDisplayHomeAsUpEnabled(true)

        nvsd.setRouteJumpOTJAction(this, false)
        if (TextUtils.isEmpty(routeFrom) || lastUUID == outPageUUid) {
            mFinish()
            return
        }

        lastUUID = outPageUUid!!
        if (yyee.llee.mmee.pl190.host668.RouteKey.HOME_KEY == routeFrom) {
            yyee.llee.mmee.pl190.host668.SharedPreUtils.getInstance().putLong(
                yyee.llee.mmee.pl190.host668.RouteKey.HOME_KEY, System.currentTimeMillis()
            )
        }
    }

    override fun showAd() {
        showUserViewDislike()
        mHandler.postDelayed(Runnable { showAdImpl() }, 500)
    }

    private fun findCachedViewById(i: Int): View {
        val map: MutableMap<Int?, View?> = this.findViewCache.toMutableMap()
        val view = map[Integer.valueOf(i)]
        if (view == null) {
            val findViewById = findViewById<View>(i)
            map[Integer.valueOf(i)] = findViewById
            return findViewById
        }
        return view
    }

    @SuppressLint("UseCompatLoadingForDrawables", "SetTextI18n")
    private fun showUserViewDislike() {
        (findCachedViewById(R.id.cl_top) as ConstraintLayout?)!!.visibility =
            View.VISIBLE
        (findCachedViewById(R.id.rl_animation) as RelativeLayout?)!!.visibility =
            View.VISIBLE
        (findCachedViewById(R.id.iv_app_logo) as ImageView?)!!.setImageResource(AppConst.logo_id)
        (findCachedViewById(R.id.tv_app_name) as TextView?)!!.text = AppConst.app_name

        val nextInt = Random().nextInt(7) + 1
        if (AppConst.INSTANCE.intOutId !== nextInt) {
            AppConst.INSTANCE.intOutId = nextInt
        } else if (nextInt == 1) {
            val appConst = AppConst.INSTANCE
            appConst.intOutId = appConst.intOutId + 1
        } else {
            val appConst3 = AppConst.INSTANCE
            appConst3.intOutId = appConst3.intOutId - 1
        }
        when (AppConst.INSTANCE.intOutId) {
            1 -> {
                (findCachedViewById(R.id.rl_app_internet) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                val loadAnimation = AnimationUtils.loadAnimation(this, R.anim.anim_scale_in)
                Intrinsics.checkNotNullExpressionValue(
                    loadAnimation,
                    "loadAnimation(this, R.anim.anim_scale_in)"
                )
                (findCachedViewById(R.id.iv_internet_pay) as ImageView?)!!.animation =
                    loadAnimation
                (findCachedViewById(R.id.iv_internet_pay) as ImageView?)!!.startAnimation(
                    loadAnimation
                )
                val string = getString(R.string.clean_hint_network_safety01)
                Intrinsics.checkNotNullExpressionValue(
                    string,
                    "getString(R.string.clean_hint_network_safety01)"
                )
                AppConst.showAdHeadTitle = string
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_network_safety0)
            }

            2 -> {
                (findCachedViewById(R.id.rl_app_antivirus) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                val rotateAnimation = RotateAnimation(0.0f, 360.0f, 1, 0.5f, 1, 0.5f)
                rotateAnimation.interpolator = LinearInterpolator()
                rotateAnimation.duration = 1000L
                rotateAnimation.repeatCount = -1
                rotateAnimation.fillAfter = true
                rotateAnimation.startOffset = 10L
                (findCachedViewById(R.id.iv_app_antivirus_quan) as ImageView?)!!.animation =
                    rotateAnimation
                val string2 = getString(R.string.clean_hint_virus_kill01)
                Intrinsics.checkNotNullExpressionValue(
                    string2,
                    "getString(R.string.clean_hint_virus_kill01)"
                )
                AppConst.showAdHeadTitle = string2
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_virus_kill0)
                object : CountDownTimer(1000, 1000) {
                    // android.os.CountDownTimer
                    override fun onFinish() {
                        (findCachedViewById(R.id.iv_app_antivirus_one) as ImageView).visibility =
                            View.GONE
                        (findCachedViewById(R.id.iv_app_antivirus_two) as ImageView).visibility =
                            View.GONE
                        (findCachedViewById(R.id.iv_app_antivirus_three) as ImageView).visibility =
                            View.GONE
                        (findCachedViewById(R.id.iv_app_antivirus_four) as ImageView).visibility =
                            View.GONE
                        (findCachedViewById(R.id.iv_app_antivirus_five) as ImageView).visibility =
                            View.GONE
                    }

                    // android.os.CountDownTimer
                    override fun onTick(millisUntilFinished: Long) {
                        val j = millisUntilFinished / 1000
                        if (j > 1) {
                            (findCachedViewById(R.id.iv_app_antivirus_one) as ImageView).visibility =
                                View.GONE
                            (findCachedViewById(R.id.iv_app_antivirus_two) as ImageView).visibility =
                                View.GONE
                            (findCachedViewById(R.id.iv_app_antivirus_three) as ImageView).visibility =
                                View.GONE
                            (findCachedViewById(R.id.iv_app_antivirus_four) as ImageView).visibility =
                                View.GONE
                            (findCachedViewById(R.id.iv_app_antivirus_five) as ImageView).visibility =
                                View.GONE
                        }
                        if (j > 0) {
                            (findCachedViewById(R.id.iv_app_antivirus_one) as ImageView).visibility =
                                View.VISIBLE
                            (findCachedViewById(R.id.iv_app_antivirus_two) as ImageView).visibility =
                                View.VISIBLE
                            (findCachedViewById(R.id.iv_app_antivirus_three) as ImageView).visibility =
                                View.VISIBLE
                            (findCachedViewById(R.id.iv_app_antivirus_four) as ImageView).visibility =
                                View.VISIBLE
                            (findCachedViewById(R.id.iv_app_antivirus_five) as ImageView).visibility =
                                View.VISIBLE
                        }
                    }
                }.start()
            }

            3 -> {
                (findCachedViewById(R.id.rl_app_scan) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                val rotateAnimation2 = RotateAnimation(0.0f, 360.0f, 1, 0.5f, 1, 0.5f)
                rotateAnimation2.interpolator = LinearInterpolator()
                rotateAnimation2.duration = 1000L
                rotateAnimation2.repeatCount = -1
                rotateAnimation2.fillAfter = true
                rotateAnimation2.startOffset = 10L
                (findCachedViewById(R.id.iv_app_scan_quan) as ImageView?)!!.animation =
                    rotateAnimation2
                val nextInt2 = Random().nextInt(1000) + 50
                val textView = findCachedViewById(R.id.tv_flow_type) as TextView?
                //                StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
                val string3 = resources.getString(R.string.clean_hint_trash0)
                Intrinsics.checkNotNullExpressionValue(
                    string3,
                    "getResources().getString…string.clean_hint_trash0)"
                )
                val format = String.format(string3, nextInt2)
                Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)")
                textView!!.text = format
            }

            4 -> {
                (findCachedViewById(R.id.rl_app_pay) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_safe_content)
                val objectRef: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    240.0f,
                    0.0f
                )
                val objectRef2: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef2.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    -100.0f,
                    0.0f
                )
                (objectRef.element as ObjectAnimator).startDelay = 100L
                (objectRef2.element as ObjectAnimator).startDelay = 100L
                (objectRef.element as ObjectAnimator).duration = 500L
                (objectRef2.element as ObjectAnimator).duration = 500L
                (objectRef.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef2.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$1
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef2.element as ObjectAnimator).start()
                    }
                })
                (objectRef2.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$2
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef.element as ObjectAnimator).start()
                    }
                })
                (objectRef.element as ObjectAnimator).start()
                val rotateAnimation3 = RotateAnimation(0.0f, 360.0f, 1, 0.5f, 1, 0.5f)
                rotateAnimation3.interpolator = LinearInterpolator()
                rotateAnimation3.duration = 1000L
                rotateAnimation3.repeatCount = -1
                rotateAnimation3.fillAfter = true
                rotateAnimation3.startOffset = 10L
                (findCachedViewById(R.id.iv_app_pay_quan) as ImageView?)!!.animation =
                    rotateAnimation3
                val string4 = getString(R.string.clean_hint_privacy_safety01)
                Intrinsics.checkNotNullExpressionValue(
                    string4,
                    "getString(R.string.clean_hint_privacy_safety01)"
                )
                AppConst.showAdHeadTitle = string4
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_privacy_safety0)
            }

            5 -> {
                (findCachedViewById(R.id.rl_app_pay) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                (findCachedViewById(R.id.iv_app_pay_quan) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_pay_content)
                val objectRef3: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef3.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    200.0f,
                    0.0f
                )
                val objectRef4: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef4.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    -100.0f,
                    0.0f
                )
                (objectRef3.element as ObjectAnimator).startDelay = 100L
                (objectRef4.element as ObjectAnimator).startDelay = 100L
                (objectRef3.element as ObjectAnimator).duration = 500L
                (objectRef4.element as ObjectAnimator).duration = 500L
                (objectRef3.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef4.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef3.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$3
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef4.element as ObjectAnimator).start()
                    }
                })
                (objectRef4.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$4
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef3.element as ObjectAnimator).start()
                    }
                })
                (objectRef3.element as ObjectAnimator).start()
                val string5 = getString(R.string.clean_hint_pay_env01)
                Intrinsics.checkNotNullExpressionValue(
                    string5,
                    "getString(R.string.clean_hint_pay_env01)"
                )
                AppConst.showAdHeadTitle = string5
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_pay_env0)
            }

            6 -> {
                (findCachedViewById(R.id.rl_app_pay) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_account_content)
                (findCachedViewById(R.id.iv_app_pay_quan) as ImageView?)!!.visibility =
                    View.GONE
                val objectRef5: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef5.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    200.0f,
                    0.0f
                )
                val objectRef6: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef6.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    -100.0f,
                    0.0f
                )
                (objectRef5.element as ObjectAnimator).startDelay = 100L
                (objectRef6.element as ObjectAnimator).startDelay = 100L
                (objectRef5.element as ObjectAnimator).duration = 500L
                (objectRef6.element as ObjectAnimator).duration = 500L
                (objectRef5.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef6.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef5.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$5
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef6.element as ObjectAnimator).start()
                    }
                })
                (objectRef6.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$6
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef5.element as ObjectAnimator).start()
                    }
                })
                (objectRef5.element as ObjectAnimator).start()
                val string6 = getString(R.string.clean_hint_account_safety01)
                Intrinsics.checkNotNullExpressionValue(
                    string6,
                    "getString(R.string.clean_hint_account_safety01)"
                )
                AppConst.showAdHeadTitle = string6
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_account_safety0)
            }

            7 -> {
                (findCachedViewById(R.id.rl_app_pay) as RelativeLayout?)!!.visibility =
                    View.VISIBLE
                (findCachedViewById(R.id.iv_app_pay_quan) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_safe_content)
                val objectRef7: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef7.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    200.0f,
                    0.0f
                )
                val objectRef8: Ref.ObjectRef<ObjectAnimator> = Ref.ObjectRef<ObjectAnimator>()
                objectRef8.element = ObjectAnimator.ofFloat(
                    findCachedViewById(R.id.iv_app_pay_sao) as ImageView?,
                    "translationY",
                    0.0f,
                    -100.0f,
                    0.0f
                )
                (objectRef7.element as ObjectAnimator).startDelay = 100L
                (objectRef8.element as ObjectAnimator).startDelay = 100L
                (objectRef7.element as ObjectAnimator).duration = 500L
                (objectRef8.element as ObjectAnimator).duration = 500L
                (objectRef7.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef8.element as ObjectAnimator).interpolator = LinearInterpolator()
                (objectRef7.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$7
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef8.element as ObjectAnimator).start()
                    }
                })
                (objectRef8.element as ObjectAnimator).addListener(object :
                    AnimatorListenerAdapter() {
                    // from class: com.kwad.sdk.api.proxy.app.ExampleAnActivity$showUserViewDislike$8
                    // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                        (objectRef7.element as ObjectAnimator).start()
                    }
                })
                (objectRef7.element as ObjectAnimator).start()
                val string7 = getString(R.string.clean_hint_safe_check01)
                Intrinsics.checkNotNullExpressionValue(
                    string7,
                    "getString(R.string.clean_hint_safe_check01)"
                )
                AppConst.showAdHeadTitle = string7
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_safe_check0)
            }

            8 -> {}
        }
        mHandler.postDelayed(Runnable { isShowViewDislikeTwo() }, 1500)
    }

    private fun isShowViewDislikeTwo() {
        when (AppConst.INSTANCE.intOutId) {
            1 -> {
                (findCachedViewById(R.id.iv_internet_pay) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_internet_pay) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.iv_app_internet_quan) as ImageView?)!!.setImageResource(R.drawable.icon_app_net_scan_done)
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_account_safety1)
            }

            2 -> {
                (findCachedViewById(R.id.iv_app_antivirus_quan_bg) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.iv_app_antivirus_quan) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_app_antivirus_relute) as ImageView?)!!.visibility =
                    View.VISIBLE
                (findCachedViewById(R.id.iv_app_antivirus_quan) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_virus_kill1)
            }

            3 -> (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                getString(R.string.clean_hint_trash1)

            4 -> {
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_privacy_scan_done)
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.iv_app_pay_quan) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_app_pay_quan) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_privacy_safety1)
            }

            5 -> {
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_pay_scan_done)
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_pay_env1)
            }

            6 -> {
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_pay_scan_done)
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_account_safety0)
            }

            7 -> {
                (findCachedViewById(R.id.iv_app_pay) as ImageView?)!!.setImageResource(R.drawable.icon_app_pay_scan_done)
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.clearAnimation()
                (findCachedViewById(R.id.iv_app_pay_sao) as ImageView?)!!.visibility =
                    View.GONE
                (findCachedViewById(R.id.tv_flow_type) as TextView?)!!.text =
                    getString(R.string.clean_hint_safe_check1)
            }

            8 -> {}
        }
        mHandler.postDelayed(Runnable { showAdImpl() }, 500)
    }

    private fun showAdImpl() {
        var ggKey = intent.getStringExtra(HandlerPostAdInterface.HANDLE_ADKEY)
        val ggPosition = intent.getIntExtra(HandlerPostAdInterface.HANDLE_ADINDEX, -1)

        if (TextUtils.isEmpty(ggKey) || !TextUtils.isEmpty(routeFrom)) {
            if (TextUtils.isEmpty(ggKey)) {
                ggKey = routeFrom
            }
        } else {
            mFinish()
            return
        }

        val mAdInterface = HandlerPostAdInterface.copy(ggKey, ggPosition)

        val autoConfigAd = AutoConfigAdViewScope()

        val adParams = AdParams().also {
            it.activity = WeakReference(this)
            it.adkey = routeFrom
            it.continaer = WeakReference(adFrameLayout)

        }

        if (routeFrom != null) {
            //AdHandlerUtils.updateShowStatus(routeFrom!!,ggPosition)
            nvsd.updateShowStatus(this, routeFrom!!, ggPosition)
        }

        addAd(autoConfigAd)?.show(adParams, mAdInterface, object : ScopeFinishListener {
            override fun showLoading() {}

            override fun hideLoading() {}

            override fun onComplete() {
                mFinish()
            }

            override fun toNextAndFinish() {
                mFinish()
            }

        })


    }

    override fun onDestroy() {
        super.onDestroy()
        var countDownTimer: CountDownTimer? = this.countDownTimer
        if (countDownTimer != null) {
            if (countDownTimer != null) {
                countDownTimer.cancel()
            }
            countDownTimer = null
        }
    }
}